﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chinesys.Entities;

namespace Chinesys.Domain.InputValidations
{
    public class RoleInputValidation : InputValidationBase
    {
        private RoleEntity entity;

        public RoleInputValidation(RoleEntity entity)
        {
            this.entity = entity;
        }

        public override void Validate()
        {
            if (string.IsNullOrEmpty(entity.RoleName))
                Errors.Add(new Required("Role Name"));

            if (entity.RoleName.Length > 200)
                Errors.Add(new Lenght("Role Name", 200));

            if (!string.IsNullOrEmpty(entity.Description) && entity.Description.Length > 500)
                Errors.Add(new Lenght("Description", 500));
        }
    }
}
